var express = require("express");
var router = express.Router();
const { formatResponse, analysisToken } = require("../utils/tool");
const { ValidationError } = require("../utils/errors");
const {
  findBannerService,
  updateBannerService,
} = require("../service/bannerService");

router.get("/", async function (req, res, next) {
  const data = await findBannerService();
  res.send(formatResponse(0, "", data));
});

router.post("/", async function (req, res, next) {
  // console.log(req.body);
  // return;
  const data = await updateBannerService(req.body);
  res.send(formatResponse(0, "", data));
});

module.exports = router;
